<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" session="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">

    <title>开门日志</title>


    <link href="${pageContext.request.contextPath}/static/css/common.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/font-awesome-4.3.0/css/font-awesome.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/css/select2.min.css"
          rel="stylesheet">
    <!-- jqgrid-->
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/custom.ui.jqgrid.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/style.css" rel="stylesheet">

    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>

    <script src="${pageContext.request.contextPath}/static/js/jquery.form.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/common.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/i18n/grid.locale-cn.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/minified/jquery.jqGrid.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/layer/layer.js" type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/static/js/global.js"></script>
	<script src="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/js/select2.min.js"></script>
	<script type="text/javascript"
            src="${pageContext.request.contextPath}/static/plugins/My97DatePicker/WdatePicker.js"></script>
    <style type="text/css">
        .main h5 a {
            position: absolute;
            right: 20px;
            font-size: 14px;
            bottom: 0px;
            display: inline-block;
            padding: 5px;
        }

        .table_list tbody tr {
            height: 35px;
            text-align: center;
        }
        .butt{
        	width: 100px;
		}
		.left ul li{

			*line-height:40px;

			*padding-left:20px;
		}

		.left ul li a, .left ul li a:hover{
			*color:#fff;
		}
		.wrapper{
			*margin-left:270px;
		}
		.form-group{
			*overflow: hidden;
		}

		.btn{
			*width:72px;
		}
		.lt{
			float:left;
		}
		.form-control{
			*padding:0;

		}
		.ui-pg-button{
			*background:#ccc;
		}
		.form-group .selectlabe1 {width:104px !important;*+width:74px !important;}
		.selectdivs{width:150px !important;}
		#ptimeStart1,#ptimeEnd1{width:128px;border-radius: 6px;}
		.selectdivs{width:139px !important;*+width:123px !important;}
		.select2-container--default .select2-selection--single .select2-selection__rendered{*+line-height:32px;}
    </style>
</head>
<body view="menu-item-4142">
<jsp:include page="../../top.jsp"></jsp:include>
<div class="right">
 	<div class="wrapper">
        <div class="panel panel-default">
            <div class="panel-heading">
                <span><strong>查询条件</strong></span>

                <div class="ibox-tools">
                    <a class="collapse-link"> <i class="fa fa-chevron-down"></i></a>
                    <a class="collapse-link  d-n"> <i class="fa fa-chevron-up"></i></a>
                </div>
            </div>
            <div class="panel-body">
                <form class="form-horizontal">
			        <c:if test="${userRole == 1 || userRole == 2 || userRole == 21}">
	                    <div class="form-group">
	                        <label class="selectlabe1 col-md-1 form-lable lt">公司名称：</label>
	                        <div class="selectdivs col-md-3 lt">
	                            <select name="agtCode" id="agtCode" class="form-control col-md-1"></select>
	                        </div>
	                        <c:if test="${rLevel == 3 || rLevel == 4}">
	                        	<label class="selectlabe1 col-md-1 form-lable lt">锁名称：</label>
		                 	</c:if>
		                 	<c:if test="${rLevel != 3 && rLevel != 4}">
	                        	<label class="selectlabe1 col-md-1 form-lable lt">小区名称：</label>
		                 	</c:if>
	                        <div class="selectdivs col-md-3 lt">
	                            <select name="communityId" id="communityId" class="form-control col-md-1"></select>
	                        </div>
	                      	<label class="selectlabe1 col-md-1 lt form-lable">所属区域：</label>
				            <div id="region" class="selectdivs col-md-3 lt" style="padding-left: 0px;">
				                <script type="text/javascript">
				                    loadCity();
				                </script>
				            </div>
	                      </div>
			          </c:if>
			          <c:if test="${userRole == 3 || userRole == 4}">
			          <div class="form-group">
				          <c:if test="${rLevel == 3 || rLevel == 4}">
	                        	<label class="selectlabe1 col-md-1 lt form-lable">主用户：</label>
		                 	</c:if>
		                 	<c:if test="${rLevel != 3 && rLevel != 4}">
	                        	<label class="selectlabe1 col-md-1 lt form-lable">小区名称：</label>
		                 	</c:if>
	                      <div class="selectdivs2 col-md-3 lt">
	                      <select name="communityId" id="communityId" class="form-control col-md-1"></select>
	                      </div>
	                      <label class="selectlabe1 col-md-1 lt form-lable">开门时间从：</label>
	                        <div class="selectdivs2 col-sm-3 lt">
	                            <div class="div2 input-group">
	                                <input class="form-control" name="ptimeStart1" id='ptimeStart1'
	                                       onclick='WdatePicker()' onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"/>
	                            </div>
	                        </div>
	                        <label class="selectlabe1 col-md-1 form-lable lt">开门时间到：</label>
	                        <div class="selectdivs2 col-sm-3 lt">
	                            <div class="div2 input-group">
	                                <input class="form-control" name="ptimeEnd1" id='ptimeEnd1'
	                                       onclick='WdatePicker()' onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"/>
	                            </div>
	                        </div>
				      </div>

				       <div class="form-group">
	                      	<label class="selectlabe1 col-md-1 lt form-lable">用&nbsp;&nbsp;户：</label>
	                        <div class="selectdivs2 col-md-3 lt" >
	                            <input id="userName" name="userName" type="text" class="form-control" />
	                        </div>
	                      <label class="selectlabe1 col-md-1 lt form-lable">所属区域：</label>
			              <div id="region" class="selectdivs col-md-3 lt" style="padding-left:0px;">
			                <script type="text/javascript">
			                    loadCity();
			                </script>
			              </div>

				      		<label class="selectlabe1 col-md-1 form-lable lt">开门方式：</label>
	                        <div class="selectdivs2 col-md-3 lt">
	                            <select name="type" id="type" class="form-control col-md-1 lt">
	                                <option value="">请选择类型</option>
	                                <option value="0">访客微信开门</option>
	                                <option value="1">用户微信开门</option>
	                                <option value="2">APP开门</option>
	                                <option value="3">指纹开门</option>
	                                <option value="4">密码开门</option>
	                                <option value="5">门禁卡</option>
	                                <option value="6">机械钥匙</option>
	                            </select>
	                        </div>
	                   </div>
	           		   <div class="form-group">
	                         <c:if test="${rLevel == 3 || rLevel == 4}">
	                        	<label class="selectlabe1 col-md-1 form-lable lt">智能锁名：</label>
		                 	</c:if>
		                 	<c:if test="${rLevel != 3 && rLevel != 4}">
	                        	<label class="selectlabe1 col-md-1 lt form-lable">门禁名称：</label>
		                 	</c:if>
	                        <div class="selectdivs2 col-md-3 lt">
	                            <input id="cbName" name="cbName" type="text" class="form-control"/>
	                        </div>
	                      	<label class="selectlabe1 col-md-1 lt form-lable">手机号：</label>
	                        <div class="selectdivs2 col-md-3 lt" style="width: 130px !important;">
	                            <input id="tel" name="tel" type="text" class="form-control"/>
	                        </div>

	                        <div class="col-md-1 form-action lt">
	                            <button class="btn btn-success form-control" id="query">查询</button>
	                        </div>
	                        <div class="col-md-1 form-action lt">
	                            <button class="btn btn-success form-control lt" id="resetForm">清空</button>
	                        </div>
	                        <div class="col-md-1 form-action lt">
	                            <button class="butt btn btn-success form-control lt" id="excel">导出EXCEL</button>
	                            <a id="ecxelExport" href="${pageContext.request.contextPath}/admin/openlog_exportExcel.action"></a>
	                        </div>
	                     </div>
			          </c:if>
                      <c:if test="${userRole == 1 || userRole == 2 || userRole == 21 || userRole == 5 || userRole == 6}">
	                      <div class="form-group">
	                      <label class="selectlabe1 col-md-1 form-lable lt">开门时间从：</label>
	                        <div class="selectdivs2 col-sm-3 lt">
	                            <div class="div2 input-group lt">
	                                <input class="form-control" name="ptimeStart1" id='ptimeStart1'
	                                       onclick='WdatePicker()' onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"/>
	                            </div>
	                        </div>
	                        <label class="selectlabe1 col-md-1 form-lable lt">开门时间到：</label>
	                        <div class="selectdivs2 col-sm-3 lt">
	                            <div class="div2 input-group lt">
	                                <input class="form-control " name="ptimeEnd1" id='ptimeEnd1'
	                                       onclick='WdatePicker()' onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"/>
	                            </div>
	                        </div>
	                      	<label class="selectlabe1 col-md-1 form-lable lt">用&nbsp;&nbsp;户：</label>
	                        <div class="selectdivs col-md-3 lt" >
	                            <input id="userName" name="userName" type="text" class="form-control"/>
	                        </div>

	                      </div>
	                      <div class="form-group">
	                       	<label class="selectlabe1 col-md-1 lt form-lable">开门方式：</label>
	                        <div class=" col-md-3 lt" style="padding-left:0px;width: 130px;*+width:114px;">
	                            <select name="type" id="type" class="form-control col-md-1" style="width: 130px;">
	                                <option value="">请选择类型</option>
									<option value="0">访客微信开门</option>
									<option value="1">用户微信开门</option>
	                                <option value="2">APP开门</option>
									<option value="3">指纹开门</option>
									<option value="4">密码开门</option>
									<option value="5">门禁卡</option>
									<option value="6">机械钥匙</option>
	                            </select>
	                        </div>

	                         <c:if test="${rLevel == 3 || rLevel == 4}">
	                        	<label class="selectlabe1 col-md-1 lt form-lable" style="margin-left: 6px;">智能锁名：</label>
		                 	</c:if>
		                 	<c:if test="${rLevel != 3 && rLevel != 4}">
	                        	<label class="selectlabe1 col-md-1 lt form-lable" style="margin-left: 6px;">门禁名称：</label>
		                 	</c:if>
	                        <div class="selectdivs col-md-3 lt">
	                            <input id="cbName" name="cbName" type="text" class="form-control" style="width:134px;margin-left:0px "/>
	                        </div>
	                      	<label class="selectlabe1 col-md-1 lt form-lable">手机号：</label>
	                        <div class="selectdivs col-md-3 lt" >
	                            <input id="tel" name="tel" type="text" class="form-control"/>
	                        </div>
		                   </div>
	                      <div class="form-group">
	                        <div class="col-md-1 lt form-action ">
	                            <button class="btn btn-success form-control" id="query">查询</button>
	                        </div>
	                        <div class="col-md-1 form-action lt">
	                            <button class="btn btn-success form-control" id="resetForm">清空</button>
	                        </div>
	                        <div class="col-md-1 form-action lt">
	                            <button class="butt btn btn-success form-control" id="excel">导出EXCEL</button>
	                            <a id="ecxelExport" href="${pageContext.request.contextPath}/admin/openlog_exportExcel.action"></a>
	                        </div>

	                    </div>
                     </c:if>
                </form>
            </div>
        </div>
	    <div class="jqGrid_wrapper">
	        <div id="jqGrid_operation" class="jg-grid">
	            <h1>开门日志</h1>
	            <div class="jqGrid_operation" id="action"></div>
	        </div>
	        <table id="jqGrid"></table>
	        <div id="jqGrid_paper"></div>
	    </div>
	</div>
</div>
<script>
    $(document).ready(
            function () {
                $.jgrid.defaults.styleUI = "Bootstrap";
                if('${rLevel}'==3 || '${rLevel}'==4){//锁厂
	                $("#jqGrid").jqGrid({
	                      url: "${pageContext.request.contextPath}/admin/openlog_page.action?userId=${userId}&pid=${pid}",
	                      mtype: 'POST',
	                      datatype: "json",
	                      height: 350,
	                      autowidth: true,
	                      shrinkToFit: true,
	                      rowNum: 10,
	                      rowList: [10, 20, 30],
	                      colNames: ['序号','所属区域', '公司名称', '主用户',
	                          '姓名', '手机号', '开门方式', '开门时间'],
	                      colModel: [{
	                          name: "SID",
	                          index: "SID",
	                          key: true,
	                          hidden: true
	                      }, {
	                          name: 'CITYCODE',
	                          index: 'CITYCODE',
	                          width: 90
	                      }, {
	                          name: 'AGTNAME',
	                          index: 'AGTNAME',
	                          width: 90
	                      }, {
	                          name: 'COMMUNITYNAME',
	                          index: 'COMMUNITYNAME',
	                          width: 80
	                      }, {
	                          name: "AUNAME",
	                          index: "AUNAME",
	                          width: 80,
	                          formatter: function (cellvalue, options, rawObject) {
	                          	if(cellvalue=='no' || !cellvalue){
	                              	return '';
	                              }if (rawObject.OPENTYPE != 2){
	                              	return cellvalue+"的访客开门";
	                              }else{
	                              	return cellvalue;
	                              }
	                          }
	                      }, {
	                          name: "TEL",
							  width: 40,
	                          index: "TEL"

	                      },{
	                          name: 'OPENTYPE',
	                          index: 'OPENTYPE',
	                          width: 80,
	                          formatter: "select",
	                          editoptions: {value: "0:访客微信开门;1:用户微信开门;2:APP开门;3:指纹开门;4:密码开门;5:门禁卡;6:机械钥匙"}
	                      }, {
	                          name: "OTIME",
							  width: 80,
	                          index: "OTIME"
	                      }],
	                      sortname: 'ab.otime1',
	                      sortorder:'desc',
	                      rownumbers: true,
	                      jsonReader: {
	                          root: 'rows',
	                          page: "page",
	                          total: 'total',
	                          records: "records",
	                          repeatitems: false
	                      },
	                      pager: "#jqGrid_paper",
	                      viewrecords: true,
	                      multiselect: true,
	                      hidegrid: false,
	                      loadComplete: function(){
	                    		var re_records = Number($("#jqGrid").getGridParam('records'));
	                    		var page = Number($("#jqGrid").getGridParam('page'));
	                    		var rows=Number($("#jqGrid").getGridParam('rowNum'));
	                    		var num = re_records-(page-1)*rows;
	                    		if(num < rows)
	                    		{
	                    			for(var i=num;i<rows;i++){
	                    				$("#jqGrid").jqGrid("addRowData",(i+1),
	                            				{ "SID":"", "CITYCODE":"", "AGTNAME":"", "COMMUNITYNAME":"", "OPENTYPE":"no","INSTALLNAME":"","AUNAME":"no","TEL":"","OTIME":""}
	                    				,"");
	                    			}
	                    			$(".ui-paging-info").html(re_records-num+1 +" - "+re_records+"　共 "+re_records+" 条");
	                    		}
	                    	}
	                  });
                }else{//普通客户
                $("#jqGrid").jqGrid({
                      url: "${pageContext.request.contextPath}/admin/openlog_page.action?userId=${userId}&pid=${pid}",
                      mtype: 'POST',
                      datatype: "json",
                      height: 362,
                      autowidth: true,
                      shrinkToFit: true,
                      rowNum: 10,
                      rowList: [10, 20, 30],
                      colNames: ['序号','所属区域', '公司名称', '小区名称', '门禁名称',
                          '姓名', '手机号', '状态', '开门方式', '开门时间'],
                      colModel: [{
                          name: "SID",
                          index: "SID",
                          key: true,
                          hidden: true
                      }, {
                          name: 'CITYCODE',
                          index: 'CITYCODE',
                          width: 60
                      }, {
                          name: 'AGTNAME',
                          index: 'AGTNAME',
                          width: 60
                      }, {
                          name: 'COMMUNITYNAME',
                          index: 'COMMUNITYNAME',
                          width: 60
                      },{
                          name: 'INSTALLNAME',
                          index: 'INSTALLNAME',
                          width: 60
                      }, {
                          name: "AUNAME",
                          index: "AUNAME",
                          width: 40,
                          formatter: function (cellvalue, options, rawObject) {
                          	if(cellvalue=='no' || !cellvalue){
                              	return '';
                              }if (rawObject.OPENTYPE != 2){
                              	return cellvalue+"的访客开门";
                              }else{
                              	return cellvalue;
                              }
                          }
                      }, {
                          name: "TEL",
						  width: 40,
                          index: "TEL"

                      }, {
                          name: "UTYPE",
                          index: "UTYPE",
                          formatter: "select",
                          width: 50,
                          editoptions: {value: "1:户主;2:主租客;3:住户;4:租客"}

                      }, {
                          name: 'OPENTYPE',
                          index: 'OPENTYPE',
                          width: 80,
                          formatter: "select",
                          editoptions: {value: "0:访客微信开门;1:用户微信开门;2:APP开门;3:指纹开门;4:密码开门;5:门禁卡;6:机械钥匙"}
                      },{
                          name: "OTIME",
						  width: 80,
                          index: "OTIME"
                      }],
                      sortname: 'ab.otime1',
                      sortorder:'desc',
                      rownumbers: true,
                      jsonReader: {
                          root: 'rows',
                          page: "page",
                          total: 'total',
                          records: "records",
                          repeatitems: false
                      },
                      pager: "#jqGrid_paper",
                      viewrecords: true,
                      multiselect: true,
                      hidegrid: false,
                      loadComplete: function(){
                    		var re_records = Number($("#jqGrid").getGridParam('records'));
                    		var page = Number($("#jqGrid").getGridParam('page'));
                    		var rows=Number($("#jqGrid").getGridParam('rowNum'));
                    		var num = re_records-(page-1)*rows;
                    		if(num < rows)
                    		{
                    			for(var i=num;i<rows;i++){
                    				$("#jqGrid").jqGrid("addRowData",(i+1),
                            				{ "SID":"", "CITYCODE":"", "AGTNAME":"", "COMMUNITYNAME":"", "OPENTYPE":"no","INSTALLNAME":"","AUNAME":"no","TEL":"","OTIME":""}
                    				,"");
                    			}
                    			$(".ui-paging-info").html(re_records-num+1 +" - "+re_records+"　共 "+re_records+" 条");
                    		}
                    	}
                  });
                }

                if('${userRole}' == '1' || '${userRole}' == '2' || '${userRole}' == '21'){
	                $.post("${pageContext.request.contextPath}/admin/tagent_list.action", function (data) {
			            $("#agtCode").empty();
			            $("#agtCode").append("<option value=''>请选择公司</option>");
			            for (var i = 0; i < data.length; i++) {
			                $("#agtCode").append("<option value='" + data[i].agtCode + "'>" + data[i].agtName + "</option>");
			            }
			            $("#agtCode").select2({
			                "placeholder": "请选择公司",
			                "width": "100%"
			            })
			            $("#communityId").append("<option value=''>请选择社区</option>");
			            $("#agtCode").change(function () {
			            	var data = $(this).val();
			            	$.post("${pageContext.request.contextPath}/admin/tcommunity_list.action", {"agtCode": data},function (data) {
					            $("#communityId").empty();
					            if('${rLevel}'==3 || '${rLevel}'==4){
					            	$("#communityId").append("<option value=''>请选择</option>");
						        }else{
					            	$("#communityId").append("<option value=''>请选择社区</option>");
							    }
					            for (var i = 0; i < data.length; i++) {
					                $("#communityId").append("<option value='" + data[i].sid + "'>" + data[i].communityName + "</option>");
					            }
					            if('${rLevel}'==3 || '${rLevel}'==4){
						            $("#communityId").select2({
						                "placeholder": "请选择",
						                "width": "100%"
						            })
						        }else{
						            $("#communityId").select2({
						                "placeholder": "请选择社区",
						                "width": "100%"
						            })
							    }
					        }, "json");
			            })
			        }, "json");
                }else if('${userRole}' == '3' || '${userRole}' == '4' ){
                	$.post("${pageContext.request.contextPath}/admin/tcommunity_list.action",
                        function (data) {
			            $("#communityId").empty();
			            if('${rLevel}'==3 || '${rLevel}'==4){
			            	$("#communityId").append("<option value=''>请选择</option>");
				        }else{
			            	$("#communityId").append("<option value=''>请选择社区</option>");
					    }
			            for (var i = 0; i < data.length; i++) {
			                $("#communityId").append("<option value='" + data[i].sid + "'>" + data[i].communityName + "</option>");
			            }
			            if('${rLevel}'==3 || '${rLevel}'==4){
				            $("#communityId").select2({
				                "placeholder": "请选择",
				                "width": "100%"
				            })
				        }else{
				            $("#communityId").select2({
				                "placeholder": "请选择社区",
				                "width": "100%"
				            })
					    }
			        }, "json");
                }
                <!--查询-->
                jQuery("#query").click(query);
                jQuery("#resetForm").click(resetForm);
                jQuery("#excel").click(excel);
            });
    $("#communityId").select2({
        "placeholder": "请选择社区",
        "minimumResultsForSearch":-1
    })
     $("#type").select2({
        "placeholder": "请选择开门方式",
        "minimumResultsForSearch":-1
    })

    <!--刷新jqGrid表格数据-->
    function refreshGrid() {
        $("#jqGrid").trigger("reloadGrid");
    }
    function resetForm() {
        location.reload();
        return false;
    }

    function query() {
        var $agtCode = $("#agtCode").val();
        var $communityId = $("#communityId").val();
        var $cityCode = $("#cityCode").val();
        var $ptimeStart1 = $("#ptimeStart1").val();
        var $ptimeEnd1 = $("#ptimeEnd1").val();
        var $userName = $("#userName").val();
        var $type = $("#type").val();
        var $cbName = $("#cbName").val();
        var $tel = $("#tel").val();
        $("#jqGrid").jqGrid('setGridParam', {
            url: "${pageContext.request.contextPath}/admin/openlog_page.action",
            postData: {
                'agtCode': $agtCode,
                'communityId': $communityId,
                'cityCode': $cityCode,
                'ptimeStart1': $ptimeStart1,
                'ptimeEnd1': $ptimeEnd1,
                'userName': $userName,
                'type': $type,
                'cbName': $cbName,
                'tel': $tel
            }, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入*/
        return false;
    }

    function excel(){
    	 var $agtCode = $("#agtCode").val();
         var $communityId = $("#communityId").val();
         var $cityCode = $("#cityCode").val();
         var $ptimeStart1 = $("#ptimeStart1").val();
         var $ptimeEnd1 = $("#ptimeEnd1").val();
         var $userName = $("#userName").val();
         var $type = $("#type").val();
         var $cbName = $("#cbName").val();
         var $tel = $("#tel").val();
         $.post("${pageContext.request.contextPath}/admin/openlog_exportExcelCheck.action", {
        	 'agtCode': $agtCode,
             'communityId': $communityId,
             'cityCode': $cityCode,
             'ptimeStart1': $ptimeStart1,
             'ptimeEnd1': $ptimeEnd1,
             'userName': $userName,
             'type': $type,
             'cbName': $cbName,
             'tel': $tel
          }, function (result) {

              result = JSON.parse(result)
              if(result.code != 1){
	              layer.alert(result.msg);
              }else{
            	  layer.alert(result.msg);
    			window.location.href = "${pageContext.request.contextPath}/admin/openlog_exportExcel.action?agtCode="+$agtCode+"&communityId="+ $communityId+"&cityCode="+$cityCode+"&userName="+ $userName+
    			<%--window.location.href = "${pageContext.request.contextPath}/admin/openlog_exportExcel.action?agtCode="+$agtCode+"&communityId="+ $communityId+"&cityCode="+$cityCode+"&ptime1="+ $ptime1+"&userName="+ $userName+--%>
          	  "&type="+ $type+"&cbName="+ $cbName+"&tel="+ $tel;
              }
          });
         return false;
//     	return false;
    };


</script>
</body>
</html>
